GUI
Helper for showing chat messages, alerts, creating translated GUIs, and displaying interactive text.
Functions
chatMessage
sm.scrapcomputers.gui:chatMessage( message, ... )
Shows a chat message with language manager applied.
Arguments:
- message [ string ] The message to send.
- ... [ any? ] Optional arguments forwarded to the language manager.
alert
sm.scrapcomputers.gui:alert( message, ... )
Shows an alert with language manager applied.
Arguments:
- message [ string ] The message to alert.
- ... [ any? ] Additional arguments for the language manager.
createGuiFromLayout
sm.scrapcomputers.gui:createGuiFromLayout( layout, destroyOnClose, settings )
Creates a GUI from a layout file with translation support.
If you want to directly set text, then call setTextRaw as setText goes through the translation.
Arguments:
- layout [ string ] Path to the layout file.
- destroyOnClose [ boolean? ] If true, the GUI is destroyed when closed.
- settings [ [https://scrapmechanicdocs.com/docs/Game-Script-Environment/Static-Functions/sm.gui#createguifromlayout]GuiSettings? ] GUI settings.
Returns:
- [ GuiInterface ] A translated GUI interface wrapper.
translationsForGUIInterface
sm.scrapcomputers.gui:translationsForGUIInterface( gui )
Creates a fake GuiInterface that applies translations automatically to certain functions.
Arguments:
- gui [ GuiInterface ] The GUI to wrap.
Returns:
- [ GuiInterface ] A wrapped GuiInterface with translation support.
showCustomInteractiveText
sm.scrapcomputers.gui:showCustomInteractiveText( top, bottom )
Displays custom interactive text on screen with translation, icons, keybind substitution, and color formatting.
- Supports icon embedding via
#[(path)]. - Supports keybinds via
#{(binding)}. - Supports color presets via
#(ERROR|WARN|SUCCESS).
Arguments:
- top [ (string|any[])[] ] Top text entries (supports nested tables for translated entries).
- bottom [ (string|any[])[]? ] Optional bottom text entries.